aboutsummaryrefslogtreecommitdiff
path: root/src/commands/[.js
diff options
context:
space:
mode:
authorSoccera1 <[email protected]>2026-07-18 09:27:17 +1000
committerSoccera1 <[email protected]>2026-07-18 09:27:17 +1000
commit6f5241afb5bd1d6a1a8724bf06cc6f205c279402 (patch)
tree2aa852e968f6b89f2c8458333ce3e7c38b3c2450 /src/commands/[.js
parenta753f669c9bedfccb9f7f400da018bb487dca5d0 (diff)
downloadbnu-6f5241afb5bd1d6a1a8724bf06cc6f205c279402.tar.gz
bnu-6f5241afb5bd1d6a1a8724bf06cc6f205c279402.zip
Refactor to single call
Diffstat (limited to 'src/commands/[.js')
-rw-r--r--src/commands/[.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/commands/[.js b/src/commands/[.js
new file mode 100644
index 0000000..be8386d
--- /dev/null
+++ b/src/commands/[.js
@@ -0,0 +1,16 @@
+#!/usr/bin/env bun
+
+import { localeQuotedDiagnostic } from "../shared/common.js";
+import { fail } from "../shared/diagnostics.js";
+import { testExpressionStatus } from "../shared/test-expression.js";
+import { defineCommand, runAsMain } from "../shared/command.js";
+
+export async function bracketCmd(args) {
+ if (args.at(-1) !== "]") return fail("[", `missing ${localeQuotedDiagnostic("]")}`, 2);
+ return testExpressionStatus(args, "[");
+}
+
+const singleCall = defineCommand("[", bracketCmd, (args) => args.length === 1 && (args[0] === "--help" || args[0] === "--version") ? args[0] : null);
+export default singleCall;
+
+if (import.meta.main) await runAsMain(singleCall);